package com.nf.action;

import com.nf.service.CourseService;
import com.nf.service.CourseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

//@WebServlet("/testServlet")
@Controller
public class CourseAction {

    @Autowired
    private CourseService courseService;

    @RequestMapping("/testServlet")
    public String kkkkk(
            @RequestParam( value = "currentPage",required = false,defaultValue = "1") int currentPage,
            Model model
    ){
        System.out.println( "取第几页："+ currentPage);
        int recodeCount = courseService.getRecodeCount();
        int pageSize = courseService.getPageSize();
        model.addAttribute("abc",courseService.getAllCourse( currentPage ));
        model.addAttribute("recodeCount",recodeCount);
        model.addAttribute("pageSize",pageSize);
        model.addAttribute("currentPage",currentPage);
        return "test";
    }
}
